package org.Vancl.Dao.ImpI;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.Vancl.Dao.stateDao;
import org.Vancl.entity.state;
import org.Vancl.utils.BaseDao;

public class stateDaoImpl extends BaseDao implements stateDao {

	@Override
	public List<state> getAll() {
		String sql="select * from state";
		ResultSet rs=super.executeQuery(sql);
		List<state> list=new ArrayList<>();
		try {
			while (rs.next()) {
				state state=new state();
				state.setState_id(rs.getInt("state_id"));
				state.setState_state(rs.getString("state_state"));
				list.add(state);
				
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally {
			try {
				super.CloseAll(rs, rs.getStatement().getConnection(), rs.getStatement());
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return list;
	}

}
